package com.shop.user.controller;

import com.shop.entity.pojo.Brands;
import com.shop.entity.pojo.Cost;
import com.shop.entity.pojo.Style;
import com.shop.entity.pojo.Wares;
import com.shop.user.service.BrandsService;
import com.shop.user.service.CostService;
import com.shop.user.service.StyleService;
import com.shop.user.service.WaresService;
import com.shop.utils.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/wares")
public class WaresController {

    @Autowired
    private BrandsService brandsService;
    @Autowired
    private WaresService waresService;
    @Autowired
    private StyleService styleService;
    @Autowired
    private CostService costService;

    @GetMapping("/get_wares_list")
    public Result<List<Wares>> waresList(){
        return waresService.getAllWares();
    }

    @GetMapping("/get_brands_list")
    public Result<List<Brands>> getBrandsList(){
        return brandsService.getBrandsList();
    }

    @GetMapping("/get_brands_wares")
    public Result<List<Wares>> getBrandsWares(@RequestParam("brandsId") Long brandsId){
        return waresService.getBrandsWares(brandsId);
    }

    @GetMapping("/get_wares_style/{waresId}")
    public Result<List<Style>> waresDetail(@PathVariable("waresId") Long waresId){
        return styleService.waresDetail(waresId);
    }

    @GetMapping("/get_style_cost")
    public Result<List<Cost>> styleCost(@RequestParam("styleId") Long styleId){
        return costService.getStyleCost(styleId);
    }

}
